package util;

import javacc.SimpleNode;
import javacc.XYZ2TreeConstants;


//stands for a variable
public class VarNode {
	public CType type;
	public String id;
	public VarNode(SimpleNode n) {
		assert n.id==XYZ2TreeConstants.JJTVARDECL;
		assert n.jjtGetNumChildren()==2;
		type = new CType(U.getString(n.jjtGetChild(0)));
		id = U.getString(n.jjtGetChild(1));
	}
	public VarNode(CType cType, String _id) {
		type = cType;
		id = _id;
	}
	public boolean equals(Object o) {
		VarNode other = (VarNode) o;
		if (other==null)
			return false;
		else return type.equals(other.type) && id.equals(other.id);
		
	}
	
	public String toString() {
		return type.toString() + " " + id;
	}

}
